package com.atguigu.controller;

import com.atguigu.Msg;
import com.atguigu.bean.Department;
import com.atguigu.dao.DepartmentMapper;
import com.atguigu.service.DepartmentMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class DepartmentController {
    @Autowired
    private DepartmentMapperService departmentMapperService;

    @RequestMapping("/dept")
    @ResponseBody
    public Msg getDepts() {
        List<Department> list = departmentMapperService.getAll();
        return Msg.success().add("depts",list);
    }
}
